package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *口味层Mapper
 */
@Mapper
public interface DishFlavorMapper {

    /**
     * 批量保存口味数据
     * @param //List<DishFlavor>
     */
    void insertBatch(List<DishFlavor> flavors);

    /**
     * 根据菜品id删除口味数据
     * @param ids
     */
    //sql语句: delete from dish_flavor where dish_id in (?,?,?)
    void deleteByDishId(List<Long> ids);

    /**
     * 根据多个菜品id查询口味数据
     * @param id
     * @return
     */
    //sql语句: select * from dish_flavor where dish_id = ?
    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> getByDishId(Long id);

    /**
     * 根据单个菜品id删除口味数据
     * @param dishId
     */
    @Select("delete from dish_flavor where dish_id = #{dishId}")
    void deleteByDishId1(Long dishId);
}
